import React, { Component } from 'react';
import Swiper from "swiper"
import "swiper/css/swiper.css"
import './details_swiper.css';

class Detials_swiper extends Component {
    state={
        banner:["http://www.zzpinfangwang.cn/file/upload/201903/01/234025471.jpg",
            "http://www.zzpinfangwang.cn/file/upload/201903/01/234117731.jpg"]
    }
        
    componentDidMount(){
        setTimeout(() => {
            new Swiper("#swiper",{
                toop:true
            })
        }, 1000);
       
        // this.setState({
        //     banner:this.props.pic,
        // })
        // console.log(this.state.banner,"banner")
    }
   
    render() {
        // console.log(this.props,"pic")
        let pic=this.props.pic || []
        // console.log(pic,"picture")
        return (
            <div>
                <div className="swiper-container" id="swiper">
                    <div className="swiper-wrapper">
                        {
                            pic.length === 0 ? <div style={{textAlign:'center'}}>暂无图片</div> : pic.length && pic.map((item,i)=><div key={i} className="swiper-slide details_swiper">
                                <img src={item}></img>
                            </div>)
                        }                    
                    </div>
                    
                </div>
            </div>
        );
    }
}

export default Detials_swiper;